/*
* Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef OHMW_INTERFACES_C_NODE_H
#define OHMW_INTERFACES_C_NODE_H

#include <cstdint>
#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

enum ohmw_node_type {
    OHMW_NODE_TYPE_DORA,
    OHMW_NODE_TYPE_ROS,
    OHMW_NODE_TYPE_ROS2,
};

void *ohmw_node_create(const char *path, uint32_t path_len, enum ohmw_node_type type);
void ohmw_node_destroy(void *node);
int32_t ohmw_node_send(
    void *node,
    const char *path, uint32_t path_len,
    const uint8_t *data, uint32_t data_len);
int32_t ohmw_node_recv(
    void *node,
    const char *path, uint32_t path_len,
    uint8_t *data, uint32_t *data_len,
    uint32_t timeout);
int32_t ohmw_node_on_recv(
    void *node,
    const char *path, uint32_t path_len,
    void (*callback)(uint8_t *data, uint32_t data_len, void *user_data),
    void *user_data);

// TODO
int32_t ohmw_node_channel(
    void *node,
    const char *node_path, uint32_t path_len);

#ifdef __cplusplus
}
#endif

#endif
